package cn.wolfcode.rbac.mapper;

import cn.wolfcode.rbac.domain.Permission;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

public interface PermissionMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Permission record);

    Permission selectByPrimaryKey(Long id);

    List<Permission> selectAll();

    int updateByPrimaryKey(Permission record);

    List<String> selectExpression();

    int insertRoleIdAndPermissionId(@Param("roleId") Long roleId,@Param("permissionIds") List<Long> permissionIds);

    int deletePermissionIdByRoleId(Long roleId);

    /**
     * 根据角色Id查询权限信息
     * @param roleId
     * @return
     */
    List<Permission> selectPermissionsByRoleId(Long roleId);

    /**
     * 根据角色Id查询角色权限
     * @param roleId
     * @return
     */
    List<String> selectExpressionByRoleId(Long roleId);

    /**
     * 根据员工id查询所有的权限表达式
     */
    List<String> queryExpressionByEmployeeId(Long id);
}